<include file="../Public/agent.header.html" />
<link href="__PUBLIC__/Css/user.css" rel="stylesheet" type="text/css" />
<style>
.test_btn{
	background: url('/Public/Images/global/btn_s.png') no-repeat scroll 0 0 transparent;
					    border: medium none;
					    color: #666666;
					    cursor: pointer;
					    display: inline-block;
					    font-size: 12px;
					    font-weight: bold;
					    height: 25px;
					    line-height: 25px;
					    margin-top: 0;
					    text-align: center;
					    width: 70px;
}
</style>
<script type="text/javascript" src="__PUBLIC__/Js/user/common.js" charset="UTF-8"></script>
		
<script>
var CURRENT_PURL = "";
var CURRENT_PURL_DIALOG = "";
$(document).ready(function(){
	getPURL();
	$('#widget_width').blur(function(){resetinput_copyhtml($('#widget_width').val(),$('#widget_height').val());});
	$('#widget_height').blur(function(){resetinput_copyhtml($('#widget_width').val(),$('#widget_height').val());});
	$('#wzlj_title').blur(function(){resetinput_wzlj_copyhtml($('#wzlj_title').val());});
	$('#tcck_title').blur(function(){resetinput_tcck_copyhtml($('#tcck_title').val());});
});
function getPURL(){
	$.kajax({      
		url:"{:U('agent://Account/getpluginurl')}",      
		type:'post', //数据发送方式  
		data:{} ,    
		ajx_rtn_type:'JSON',
		async: false ,//同步方式     
		success: function(obj){ 
			//alert(obj.msg);
			if(obj.status==1){
				CURRENT_PURL = obj.data;
				CURRENT_PURL_DIALOG = obj.dialog;
				resetinput_copyhtml($('#widget_width').val(),$('#widget_height').val());
				resetinput_wzlj_copyhtml($('#wzlj_title').val())
				resetinput_tcck_copyhtml($('#tcck_title').val());
			}else{
				$('#input_copyhtml').val(obj.msg);
				$('#tcck_input_copyhtml').val(obj.msg);
				$('#wzlj_input_copyhtml').val(obj.msg);
				CURRENT_PURL = '';
				CURRENT_PURL_DIALOG= '';
			}
		}
	});
}
function createkey(){
	$('#input_copyhtml').val('连接密钥生成中...');
	$.kajax({      
		url:"{:U('agent://Account/recreatekey')}",      
		type:'post', //数据发送方式  
		data:{} ,    
		ajx_rtn_type:'JSON',
		async: false ,//同步方式     
		success: function(obj){ 
			//alert(obj.msg);
			if(obj.status==1){
				getPURL();
				ui.success('生成连接密钥成功！');
			}else{
				CURRENT_PURL = '';
				CURRENT_PURL_DIALOG= '';
				$('#input_copyhtml').val(obj.msg);
				$('#tcck_input_copyhtml').val(obj.msg);
				$('#wzlj_input_copyhtml').val(obj.msg);
			}
		}
	});
}
function resetinput_copyhtml(width_,height_){
	var _tmp = "";
	if(CURRENT_PURL==''){
		_tmp = '请生成连接密钥';
	}else{
		_tmp = '<iframe width="'+width_+'" height="'+height_+'" frameborder="0" scrolling="no" src="'+CURRENT_PURL+'"></iframe>';
			
	}
	$('#input_copyhtml').val(_tmp);
}

function resetinput_wzlj_copyhtml(title_){
	var _tmp = "";
	if(CURRENT_PURL==''){
		_tmp = '请生成连接密钥';
	}else{
		_tmp = '<a href="'+CURRENT_PURL_DIALOG+'" target="_blank">'+title_+'</a>';
			
	}
	$('#wzlj_input_copyhtml').val(_tmp);
	$('#wzlj_test_url').attr('href',CURRENT_PURL_DIALOG);
}

function resetinput_tcck_copyhtml(title_){
	var _tmp = "";
	if(CURRENT_PURL==''){
		_tmp = '请生成连接密钥';
	}else{
		_tmp = '<a href="javascript:void(0)" onclick="window.open( \' '+CURRENT_PURL+' \' ,\'_blank\',\'width=600,height=750\');">'+title_+'</a>';
			
	}
	$('#tcck_input_copyhtml').val(_tmp);
}

</script>
<div id="mainWrapper">
<div id="main">

	<include file="../agent/Tpl/default/Public/user_left_nav_box.html" />
  
  	<div id="right_box">
	    <div id="top_nav" class="item_top">
		    <php>if($agentstatus['status']==1){</php>
			    <php>if(empty($_SESSION['userInfo']['agent']['key'])){</php>
					<span class="btn_rl right"><a href="javascript:createkey();" style="color: #FFFFFF;">生成插件连接密钥</a></span>
				<php>}else{</php>
					<span class="btn_rl right"><a href="javascript:createkey();" style="color: #FFFFFF;">重新生成插件连接密钥</a></span>
				<php>}</php>
			<php>}</php>
			<ul>
				<li class="top_bar top-bar-wide top_baron">插件代码</li>
			</ul>
		</div>
		<div class="blank10"></div>
<php>if($agentstatus['status']!=1){</php>
	  	<div class="k_desc_div" style="margin:0 0 15px 0px;">
				<div class="k_icon k_bulb"></div>
				<strong>提示</strong>
				<div>
					{$agentstatus['msg']}
				</div>
		</div>	
<php>}else{</php>
	<div style=" border-bottom: 1px solid #E2E2E2; padding: 5px 15px;" >
		<h2 style="color: #CC0000;
    display: block;
    font-size: 14px;
    font-weight: bold;
    line-height: 22px;">嵌入代码</h2>
	</div>
	<div class="blank10"></div>
	<span class="left" style="font-size: 14px;font-weight: bold;height: 30px; line-height: 30px;">设置尺寸：
	<font>宽&nbsp;<input type="text" class="normal_input" id="widget_width" style="font-size: 14px;width: 40px;" value="600">
			&nbsp;<em class="gray9">px</em></font>
	&nbsp;&nbsp;&nbsp;&nbsp;
	<font>高&nbsp;<input type="text" class="normal_input" id="widget_height" style="font-size: 14px;width: 40px;" value="600">&nbsp;<em class="gray9">px</em></font>
	&nbsp;&nbsp;&nbsp;&nbsp;<font style="font-size:12px;color:red">建议宽度、高度最小取值均为550.</font>
	</span>
	
	<div class="clear"></div>
	<div class="blank10"></div>
	<div style="width:340px;float:right">
		<p style="display:block;height:70px;">建议如果贵网站有礼品模块，则可将嵌入代码拷贝到页面相应位置。</p>
		<p style="padding-top: 5px;">
			<span style="color: #999999;margin: 0 0 0 8px;">请将代码添加到您的网站</span>
			&nbsp;&nbsp;&nbsp;&nbsp;
			<a href="{:U('agent://Account/dkxd')}" target="_blank" class="test_btn" title="点击看看插件嵌入后是什么样" >参考样式</a>
		</p>
	</div>
	<textarea style="width:400px;height:100px;float:left" id="input_copyhtml" readonly></textarea>
	
	<div class="blank10"></div>
	<div style=" border-bottom: 1px solid #E2E2E2; padding: 5px 15px;" >
		<h2 style="color: #CC0000; display: block; font-size: 14px; font-weight: bold;
   			 line-height: 22px;">文字连接</h2>
	</div>
	<div class="blank10"></div>
	<span class="left" style="font-size: 14px;font-weight: bold;height: 30px; line-height: 30px;">连接描述：
	<input type="text" class="normal_input" id="wzlj_title" style="font-size: 14px;width: 318px;" value="录入连接描述">
	</span>
	<div class="clear"></div>
	<div class="blank10"></div>
	<div style="width:340px;float:right">
		<p style="display:block;height:70px;">
			在新窗口中打开插件。如：个人博客可选择这种方式，将相关代码复制粘贴到自己的博客的代码中；
			sina博客为例：登陆sina博客-->页面设置-->自定义组件-->添加文本组件-->填写标题--->点击显示源代码--->粘贴小心意代码--->保存完成。</p>
		<p style="padding-top: 5px;">
			<span style="color: #999999;margin: 0 0 0 8px;">请将代码添加到您的网站</span>
			&nbsp;&nbsp;&nbsp;&nbsp;
			<a href="" target="_blank" id="wzlj_test_url" class="test_btn" title="点击看看文字连接什么样" >参考样式</a>
		</p>
	</div>
	<textarea style="width:400px;height:100px;float:left" id="wzlj_input_copyhtml" readonly></textarea>
	
	<div class="blank10"></div>
	<div style=" border-bottom: 1px solid #E2E2E2; padding: 5px 15px;" >
		<h2 style="color: #CC0000; display: block; font-size: 14px; font-weight: bold;
   			 line-height: 22px;">弹出窗口</h2>
	</div>
	<div class="blank10"></div>
	<span class="left" style="font-size: 14px;font-weight: bold;height: 30px; line-height: 30px;">按钮描述：
	<input type="text" class="normal_input" id="tcck_title" style="font-size: 14px;width: 318px;" value="录入按钮描述">
	</span>
	<div class="clear"></div>
	<div class="blank10"></div>
	<div style="width:340px;float:right">
		<p style="display:block;height:70px;">这种方式表现为页面上的一个按钮，点击按钮弹出页面。下面的“参考样式”就是一个这样的按钮，点击后弹出相应页面窗口。点点看看！</p>
		<p style="padding-top: 5px;">
			<span style="color: #999999;margin: 0 0 0 8px;">请将代码添加到您的网站</span>
			&nbsp;&nbsp;&nbsp;&nbsp;
			<a href="javascript:void(0)" onclick="window.open( CURRENT_PURL ,'_blank','width=600,height=750');" class="test_btn" title="点击看看弹出窗口什么样" >参考样式</a>
		</p>
	</div>
	<textarea style="width:400px;height:100px;float:left" id="tcck_input_copyhtml" readonly></textarea>
	<div class="blank10"></div>
<php>}</php>


	</div>
		
</div>
</div>
<include file="../Public/footer.html" />